/*
 * GUIServerSimulationView.java
 */

package guiserversimulation;

import guiserver.Server;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jdesktop.application.Action;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import javax.swing.JFrame;

/**
 * The application's main frame.
 */
public class GUIServerSimulationView extends FrameView {

    private Server guiServer;

    public GUIServerSimulationView(SingleFrameApplication app) {
        super(app);

        initComponents();
        this.getFrame().addKeyListener(DrawablePanel.GetKeyListener());

        try {
            guiServer = new Server();
            guiServer.Start();
        } catch (IOException ex) {
            Logger.getLogger(GUIServerSimulationView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        mainPanel = new guiserversimulation.DrawablePanel();

        menuBar.setName("menuBar"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(guiserversimulation.GUIServerSimulationApp.class).getContext().getResourceMap(GUIServerSimulationView.class);
        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(guiserversimulation.GUIServerSimulationApp.class).getContext().getActionMap(GUIServerSimulationView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        mainPanel.setBackground(resourceMap.getColor("mainPanel.background")); // NOI18N
        mainPanel.setFocusCycleRoot(true);
        mainPanel.setFocusTraversalPolicyProvider(true);
        mainPanel.setName("mainPanel"); // NOI18N

        setComponent(mainPanel);
        setMenuBar(menuBar);
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private guiserversimulation.DrawablePanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    // End of variables declaration//GEN-END:variables

}
